home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / tick.zip / TICK.DOC < prev    next >
Text File  |  1988-03-08  |  3KB  |  63 lines

  1. All the functions in this file make heavy use of TurboC and PCDOS
  2. facilities and are not portable. 
  3.  
  4. WARNING:
  5.     DO NOT compile with tiny, small or medium models. Stack overflow
  6.     occurs and if the stack checking option of the compiler is used
  7.     then the timers are not unloaded and the system crashes - in fact
  8.     you have to setup the entire system from scratch.
  9.         
  10. USAGE:
  11.     #include "tick.h"
  12.  
  13.     int install_timer(vod (*func());
  14.         Installs the function "func()" to be called EVERY tick. 
  15.         Removes the function on exit from the program - both if
  16.         ^C or normal. You MUST NOT use the Turbo C supplied
  17.         ctrlbrk() function if you use this one. Use
  18.         "install_cbrk()" instead.
  19.  
  20.     int install_cbrk(void (*func)());
  21.         Installs the function "func()" to be called when ^C is hit.
  22.         You can chain a series of functions. If you use this DO NOT
  23.         use the Turbo C supplied ctrlbrk(). If argument is NULLVFP
  24.         ^C exits from the program.
  25.  
  26.     int remove_timer(void (*func)());
  27.         Removes "func()" from timer list. If NULLVFP is given as an
  28.         argument all timers are cleaned.
  29.  
  30.     int remove_cbrk(void (*func)());
  31.         Removes "func()" from ctrlbrk list. If argument    is NULLVFP
  32.         ^C has no action.
  33. RETURN VALUES:
  34.     0 => function was successfully installed or removed.
  35.     1 => Install failed because of lack of space. Compile again with a
  36.          larger NTIMER or NCBRK in "tick.h"
  37.          Remove  failed because function not found.
  38.     2 => Install timer failed because we could not hook timer cleaner 
  39.          onto atexit(). Try again with fewer atexit() functions.
  40.  
  41. NOTES:
  42.     * DO NOT use the Turbo C ctrlbrk() function if using these functions
  43.       - it can have quite disasterous effects. Use install_cbrk() - it 
  44.       is more general in any case !.
  45.     * Both the install functions try to check if the function is already
  46.       present and do not duplicate installations.
  47.     * Define HARDTIMER in "tick.h" if you want to use the hardware 
  48.       interrupt rather than the DOS 'soft' interrupt. This is at your own
  49.       peril. I have not used this.
  50.  
  51. BUGS:
  52.     Notify all bugs to :
  53.         Q3696@PUCC.BITNET or
  54.         {seismo, rutgers}\!princeton\!phoenix\!asjoshi
  55.  
  56. ACKNOWLEDGEMENTS:
  57.     Dean D. McCrory for two functions which really form the heart of the 
  58.     timer portion : timer_handler, and dosbusy. The first has been 
  59.     modified and made more general. It is also renamed to __tick__().
  60.     The rest of the code was written using Turbo C v1.5 entirely by me
  61.     Thanks to Borland for the wonderful (and inexpensive) C compiler.
  62.  
  63.